<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <div th:include="public/css"></div>
</head>
<body>


<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend><span th:switch="${vo}">
        <span th:case="null">新增</span>
        <span th:case="*">编辑</span>
    </span>任务</legend>
</fieldset>

<form class="layui-form" action="" method="post" lay-f>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">分类名称</label>
            <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required" autocomplete="off" class="layui-input" th:value="${vo?.name}">
            </div>
        </div>
    </div>
    <input type="hidden" name="id" th:value="${vo?.id}">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="form">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

</body>
<div th:include="public/js"></div>

<script>
    layui.use(['form'], function(){
        var form = layui.form
            ,layer = layui.layer

        //监听提交
        form.on('submit(form)', function(data){
            api.post("/Cate/doUpdate",data.field);
            return false;
        });


    });
</script>
</html>